import conf from '../config/userconf.js'
export default {
    data() {
        var validateTel = (rule,value,callback) => {    //正则手机号

            var MobileRegex = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
            if (!MobileRegex.test(value)) {
                callback(new Error('手机号格式不正确！'))
            } else {
                callback();
            }
        };
        return {
            list:[],
            current: 1,  //账号列表当前页码
            searchData:{
                anm_branch_name:'',
                start_time:'',
                end_time:'',
            },
            dialogtitle : '编辑账号',  //弹框标题
            centerDialogVisible : false,  //嵌套表格隐藏展示
            renewVisible: false,
            renew: false,
            imageUrl: '',   //营业执照  预览
            faceZUrl: '',   //法人身份证   正面  预览
            faceFUrl: '',   //法人身份证   反面  预览
            anm_business_license: {},   //营业执照  上传服务器
            anm_identity_face: {},   //法人身份证   正面  上传服务器
            anm_identity_side: {},   //法人身份证   反面  上传服务器
            form:{    //添加账号
                anm_branch_name:'',
                anm_area: '',
                anm_branch_address:'',
                anm_legal:'',
                anm_legal_phone:'',
                anm_principal:'',
                anm_principal_phone:'',
                anm_current_grade:'',
                anm_current_years:'',
                anm_app_login: '',
            },
            rules:{
                anm_branch_name: [
                    { required: true, message: '请输入公司名称', trigger: 'blur' }
                ],
                anm_area: [
                    { required: true, message: '请输入公司所属区域', trigger: 'blur' }
                ],
                anm_branch_address: [
                    { required: true, message: '请输入公司地址', trigger: 'blur' }
                ],
                anm_legal: [
                    { required: true, message: '请输入公司法人姓名', trigger: 'blur' },
                    { min: 2, max: 4, message: '长度在 2 到 4 个字符', trigger: 'blur' },
                    { pattern: /^[\u4E00-\u9FA5]+$/, message: '姓名只能为中文'}
                ],
                anm_legal_phone: [
                    { required: true, message: '请输入法人手机号码', trigger: 'blur' },
                    { validator: validateTel, trigger: 'blur'}
                ],
                anm_principal: [
                    { required: true, message: '请输入负责人姓名', trigger: 'blur' },
                    { min: 2, max: 4, message: '长度在 2 到 4 个字符', trigger: 'blur' },
                    { pattern: /^[\u4E00-\u9FA5]+$/, message: '姓名只能为中文'}
                ],
                anm_principal_phone: [
                    { required: true, message: '请输入负责人手机号码', trigger: 'blur' },
                    { validator: validateTel, trigger: 'blur'}
                ],
                anm_grade: [
                    { required: true, message: '请选择等级', trigger: 'change' }
                ],
                anm_years: [
                    { required: true, message: '请输入购买的年限', trigger: 'blur' },
                    { min: 1, message: '请输入有效的购买年限', trigger: 'blur' },
                ],
                anm_status: [
                    { required: true, message: '请选择账号状态', trigger: 'change' }
                ],
                anm_app_login: [
                    { required: true, message: '请选择app登录权限', trigger: 'change' }
                ],
            },
            renewData: {  //续费
                anm_grade: '',
                anm_years: '',
                anm_id: ''    //中介公司id
            },
            gradeList: [],  //账号等级列表
            renewRecord: [],  //续费记录列表
            recordCurrent: 1,  //续费记录当前页码
            payrecordVid: '',  //当前续费记录id
            accountNumber: '',   //账号数量
            accountMoney: '',  //总金额
            dialogVisible: false,  //放大查看图片弹框
            dialogImageUrl: '',  //图片预览路径
            //营业执照、身份证正反面  控制上传个数
            yyzzuploadDisabled: false,  
            idZuploadDisabled: false,
            idFuploadDisabled: false,
            dialogVisibleTit:　'添加账号',  //弹框标题
            yyzzfilelist: [],
            sfzzfilelist: [],
            sfzffilelist: [],
            editdelpicanm_id: '',  //修改删除图片   账号id
            creatdialogVisible: false,   //创建表
            c_id: '',  //公司id
            creatdata: [],  //创建表  名单
            btnstatus: false,  //是否可启用账号
      }
    },
    methods: {
        /* 列表*/
        getList (data=Object()){
            data.page = this.current;
            // console.log(data);
            conf.company.list(data,(state,res)=>{
                if (state == 'success'&&res.data.code == 0){
                    // console.log(res.data.data);
                    this.list = res.data.data.list;
                    this.accountNumber = res.data.data.count;
                    this.accountMoney = res.data.data.allmoney;
                }
            })
        }, 
        // 公司管理账号列表 切换页码
        handletypeCurrentChange(val) {
            this.current = val;
            this.getList();
        },
        /*查询 */
        search () {
            let data  = this.searchData;
            console.log(data);
            this.getList(data);
        },
        /*增 */
        add (formName) {
            //获取账号等级列表
            this.gradeLists();
            this.dialogVisibleTit = '添加账号';
            this.centerDialogVisible = true;
        },
        // 添加账号  表单提交
        addAccount(formName,data=Object()){

            if(this.dialogVisibleTit == '添加账号'){
                if(!this.anm_business_license.anm_business_license){
                    this.$message({
                        type: 'info',
                        message: '请上传营业执照'
                    });
                    return false;
                }else if(!this.anm_identity_face.anm_identity_face){
                    this.$message({
                        type: 'info',
                        message: '请上传法人身份证正面'
                    });
                    return false;
                }else if(!this.anm_identity_side.anm_identity_side){
                    this.$message({
                        type: 'info',
                        message: '请上传法人身份证反面' 
                    });
                    return false; 
                }
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        data = this.form;
                        data.anm_business_license = this.anm_business_license.anm_business_license;   //营业执照
                        data.anm_identity_face = this.anm_identity_face.anm_identity_face;   //法人身份证正面
                        data.anm_identity_side = this.anm_identity_side.anm_identity_side;   //法人身份证反面
                        //请求
                        conf.company.add(data,(state,res)=>{
                            if(state == 'success'&&res.data.code == 0){
                                this.getList();
                                this.$message({
                                    type: 'success',
                                    message: '添加成功'
                                });
                                this.$refs[formName].resetFields();
                                this.centerDialogVisible = false;
                            }else{
                                this.$message({
                                    type: 'info',
                                    message: res.data.msg
                                });
                            }
                        })
                    } else {
                        // console.log('error submit!!');
                        return false;
                        }
                    });

                        
            }else if(this.dialogVisibleTit == '修改账号'){

                if(this.yyzzfilelist.length == 0){
                    this.$message({
                        type: 'info',
                        message: '请上传营业执照'
                    });
                    return false;
                }else if(this.sfzzfilelist.length == 0){
                    this.$message({
                        type: 'info',
                        message: '请上传法人身份证正面'
                    });
                    return false;
                }else if(this.sfzffilelist.length == 0){
                    this.$message({
                        type: 'info',
                        message: '请上传法人身份证反面' 
                    });
                    return false; 
                }
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        data = this.form;
                        data.anm_id = this.editdelpicanm_id;
                        data.anm_business_license = this.yyzzfilelist[0].url;   //营业执照
                        data.anm_identity_face = this.sfzzfilelist[0].url;   //法人身份证正面
                        data.anm_identity_side = this.sfzffilelist[0].url;   //法人身份证反面
                        //请求
                        conf.company.edit(data,(state,res)=>{
                            if(state == 'success'&&res.data.code == 0){
                                this.getList();
                                this.$message({
                                    type: 'success',
                                    message: '修改成功'
                                });
                                this.$refs[formName].resetFields();
                                this.centerDialogVisible = false;
                            }else{
                                this.$message({
                                    type: 'info',
                                    message: res.data.msg
                                });
                            }
                        })
                    } else {
                        // console.log('error submit!!');
                        return false;
                        }
                    });
            }
        },
        //编辑账号信息
        edit(row){
            // console.log(row);
            this.yyzzfilelist = [];
            this.sfzzfilelist = [];
            this.sfzffilelist = [];

            //获取账号等级列表
            this.gradeLists();
            this.dialogVisibleTit = '修改账号';
            this.editdelpicanm_id = row.anm_id;  //修改账号id

            this.form.anm_branch_name = row.anm_branch_name;
            this.form.anm_area = row.anm_area;
            this.form.anm_branch_address = row.anm_branch_address;
            this.form.anm_legal = row.anm_legal;
            this.form.anm_legal_phone = row.anm_legal_phone;
            this.form.anm_principal = row.anm_principal;
            this.form.anm_principal_phone = row.anm_principal_phone;
            this.form.anm_app_login = row.anm_app_login.toString();

            var obj = {};
            obj.url = row.anm_business_license;
            this.yyzzfilelist.push(obj);

            var objs = {};
            objs.url = row.anm_identity_face;
            this.sfzzfilelist.push(objs);

            var objss = {};
            objss.url = row.anm_identity_side;
            this.sfzffilelist.push(objss);

            this.form.anm_current_grade = row.anm_current_grade;
            this.form.anm_current_years = row.anm_current_years;
            // this.form.anm_status = row.anm_status.toString();

            this.yyzzuploadDisabled = true;
            this.idZuploadDisabled = true;
            this.idFuploadDisabled = true;

            this.centerDialogVisible = true;
        },
        // 续费记录
        payrecord (val,data=Object()) {
            if(val){
                this.recordCurrent = 1;
                data.page = this.recordCurrent;
                this.payrecordVid = val.anm_id;
                data.anm_id = this.payrecordVid;
            }else{
                data.page = this.recordCurrent;
                data.anm_id = this.payrecordVid;
            }
            conf.company.renewLists(data,(state,res)=>{
                if (state == 'success'&&res.data.code == 0){
                    this.renewRecord = res.data.data;
                }else if(state == 'success'&&res.data.code != 0){
                    // console.log(res);
                    this.renewRecord = [];
                    this.$message({
                        type: 'info',
                        message: res.data.msg
                    });
                }
            })
            this.renewVisible = true;
        },  
        // 续费列表 切换页码
        recordCurrentChange(val) {
            this.recordCurrent = val;
            this.payrecord();
        },
        // 续费
        renewFun(val,data=null){
            this.renewData.anm_id = val.anm_id;
            //获取账号等级列表
            this.gradeLists();
            this.renew = true;
        },
        // 续费  提交
        submitRenew(formName){
            console.log(this.renewData);
            if(this.renewData.anm_years < 1){
                this.$message({
                    type: 'info',
                    message: '请输入有效购买年限'
                });
                return false;
            }else{
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        conf.company.renew(this.renewData,(state,res)=>{
                            if(state == 'success'&&res.data.code == 0){
                                this.$message({
                                    type: 'success',
                                    message: res.data.data
                                });
                                this.renew = false
                            }else{
                                this.$message({
                                    type: 'info',
                                    message: res.data.msg
                                });
                            }
                        })
                    }else{
                        // console.log('error submit!!');
                        return false;
                    }
                })
            }
            
        },
        // 续费  取消提交
        cancelRenew(formName){
            this.renew = false;
            if (formName) {
                this.$refs[formName].resetFields();
            }
        },
        //获取账号等级列表
        gradeLists(data=null){
            conf.company.gradeList(data,(state,res)=>{
                if(state == 'success'&&res.data.code == 0){
                    // console.log(res.data.data);
                    this.gradeList = res.data.data;
                }else{
                    this.$message({
                        type: 'info',
                        message: res.data.msg
                    });
                }
            })
        },
        // 更改账号状态
        editState(val,data=Object()){

            this.$confirm('确认更改当前账号状态吗?', '提示', {  
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                data.c_id = val.anm_id;
                data.status = val.anm_status;
                // console.log(data);
                conf.company.editState(data,(state,res) => {
                    if(state == 'success' && res.data.code == 0){
                        this.getList();
                        this.$message({
                            type: 'success',
                            message: '更改成功!'
                        });
                    }else if(state == 'success'&&res.data.code != 0){
                        this.$message({
                            type: 'info',
                            message: res.data.msg
                        });
                    }
                })

            }).catch(() => {
                this.$message({
                  type: 'info',
                  message: '已取消更改'
                });          
            });


            
        },
        // 账号状态
        accountState (row, column, cellValue, index) {
            switch (cellValue) {
                case 1:
                    return '启用'
                case 2:
                    return '禁用'
            }
        },
        loginFunc(row, column, cellValue, index){
            switch (cellValue) {
                case 1:
                    return '不可以'
                case 2:
                    return '可以'
            }
        },
        // 账号权限
        accountFunc (row, column, cellValue, index) {
            switch (cellValue) {
                case 1:
                    return '全部功能'
                case 2:
                    return '部分功能'
                case 3:
                    return '少部分功能'
            }
        },
        // 续费状态
        accountNm_State (row, column, cellValue, index) {
            switch (cellValue) {
                case 1:
                    return '新增'
                case 2:
                    return '续费'
            }
        },
        // 续费有效状态
        accountNm_Type (row, column, cellValue, index) {
            switch (cellValue) {
                case 1:
                    return '未审核'
                case 2:
                    return '已审核'
            }
        },
        //通过审核
        examineFun (val,data=Object()){
            console.log(val);
            this.$confirm('确认通过审核吗?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                data.nm_id = val.nm_id;
                conf.company.renewList(data,(state,res)=>{
                    if(state == 'success'&&res.data.code == 0){
                        this.$message({
                            type: 'success',
                            message: res.data.data
                        });
                        this.payrecord();
                        this.getList();
                        this.renewVisible = false;
                    }else if(state == 'success'&&res.data.code != 0){
                        this.$message({
                            type: 'info',
                            message: res.data.msg
                        });
                    }
                })
            }).catch(() => {
                this.$message({
                  type: 'info',
                  message: '已取消'
                });          
            });
        },
        // 上传图片
        upload(){
            let url = conf.baseurl + 'photo';
            return url;
        },
        // 上传文件之前
        beforeAvatarUpload(file) {
            // console.log(file);
            const isJPG = file.type === 'image/jpeg' || 'image/png' || 'image/jpg' || 'image/gif' ||'image/JPEG' || 'image/PNG' || 'image/JPG' || 'image/GIF';
            const isLt2M = file.size / 1024 / 1024 < 2;

            if (!isJPG) {
                this.$message.error('上传头像图片只能是 jpeg、png、jpg、gif 格式!');
            }
            if (!isLt2M) {
                this.$message.error('上传头像图片大小不能超过 2MB!');
            }
            return isJPG && isLt2M;
        },
        yyzzAvatarSuccess(res, file){
            // console.log(res, file);
            this.imageUrl = URL.createObjectURL(file.raw);
            this.anm_business_license.anm_business_license = res.data.preview_url;
            this.anm_business_license.add_url = res.data.add_url;

            var obj = {};
            obj.url = res.data.preview_url;
            this.yyzzfilelist.push(obj);

            // //上传成功，隐藏继续上传
            this.yyzzuploadDisabled = true;  
        },
        idZAvatarSuccess(res, file){
            // console.log(res, file);
            this.faceZUrl = URL.createObjectURL(file.raw);
            this.anm_identity_face.anm_identity_face = res.data.preview_url;
            this.anm_identity_face.add_url = res.data.add_url;

            var objs = {};
            objs.url = res.data.preview_url;
            this.sfzzfilelist.push(objs);

            //上传成功，隐藏继续上传
            this.idZuploadDisabled = true;  
        },
        idFAvatarSuccess(res, file){
            // console.log(res, file);
            this.faceFUrl = URL.createObjectURL(file.raw);
            this.anm_identity_side.anm_identity_side = res.data.preview_url;
            this.anm_identity_side.add_url = res.data.add_url;

            var objss = {};
            objss.url = res.data.preview_url;
            this.sfzffilelist.push(objss);

            //上传成功，隐藏继续上传
            this.idFuploadDisabled = true;  
        },
        //删除图片
        yyzzhandleRemove(data=Object()){
            // this.$confirm('确定删除吗?', '提示', {
            //     confirmButtonText: '确定',
            //     cancelButtonText: '取消',
            //     type: 'warning'
            // }).then(() => {
                data = {};
                if(this.dialogVisibleTit === '添加账号'){
                    data.file_name = this.anm_business_license.add_url;
                    conf.company.delpic(data,(state,res)=>{
                        if(state == 'success'&&res.data.code == 0){
                            this.$message({
                                type: 'success',
                                message: '删除成功'
                            });
                            
                            this.yyzzuploadDisabled = false;
                        }else{
                            this.yyzzuploadDisabled = true;
                            this.$message({
                                type: 'info',
                                message: res.data.msg
                            });
                        }
                    })
                }else if(this.dialogVisibleTit === '修改账号'){
                    data.anm_id = this.editdelpicanm_id;
                    data.type = 'anm_business_license';
                    conf.company.editdelpic(data,(state,res)=>{
                        if(state == 'success'&&res.data.code == 0){
                            this.$message({
                                type: 'success',
                                message: '删除成功'
                            });
                            this.yyzzuploadDisabled = false;
                            this.anm_business_license = {};
                            this.yyzzfilelist = [];
                        }else{
                            this.yyzzuploadDisabled = true;
                            this.$message({
                                type: 'info',
                                message: res.data.msg
                            });
                        }
                    })
                }
                
                
            // }).catch(() => {
                
            //     this.$message({
            //       type: 'info',
            //       message: '已取消删除'
            //     });          
            // });
            // return false;
            
        },
        sfzZhandleRemove(data=Object()){

            data = {};
            if(this.dialogVisibleTit === '添加账号'){
                data.file_name = this.anm_identity_face.add_url;
                conf.company.delpic(data,(state,res)=>{
                    if(state == 'success'&&res.data.code == 0){
                        this.$message({
                            type: 'success',
                            message: '删除成功'
                        });
                        this.idZuploadDisabled = false;
    
                    }else{
                        this.idZuploadDisabled = true;
                        this.$message({
                            type: 'info',
                            message: res.data.msg
                        });
                    }
                })
            }else if(this.dialogVisibleTit === '修改账号'){
                data.anm_id = this.editdelpicanm_id;
                data.type = 'anm_identity_face';
                conf.company.editdelpic(data,(state,res)=>{
                    if(state == 'success'&&res.data.code == 0){
                        this.$message({
                            type: 'success',
                            message: '删除成功'
                        });
                        this.idZuploadDisabled = false;
                        this.anm_identity_face = {};
                        this.sfzzfilelist = [];

                    }else{
                        this.idZuploadDisabled = true;
                        this.$message({
                            type: 'info',
                            message: res.data.msg
                        });
                    }
                })
            }
            
        },
        sfzFhandleRemove(data=Object()){

            data = {};
            if(this.dialogVisibleTit === '添加账号'){
                data.file_name = this.anm_identity_side.add_url;
                conf.company.delpic(data,(state,res)=>{
                    if(state == 'success'&&res.data.code == 0){
                        this.$message({
                            type: 'success',
                            message: '删除成功'
                        });
                        this.idFuploadDisabled = false;
                    }else{
                        this.idFuploadDisabled = true;
                        this.$message({
                            type: 'info',
                            message: res.data.msg
                        });
                    }
                })
            }else if(this.dialogVisibleTit === '修改账号'){
                data.anm_id = this.editdelpicanm_id;
                data.type = 'anm_identity_side';
                conf.company.editdelpic(data,(state,res)=>{
                    if(state == 'success'&&res.data.code == 0){
                        this.$message({
                            type: 'success',
                            message: '删除成功'
                        });
                        this.idFuploadDisabled = false;
                        this.anm_identity_side = {};
                        this.sfzffilelist = [];
                    }else{
                        this.idFuploadDisabled = true;
                        this.$message({
                            type: 'info',
                            message: res.data.msg
                        });
                    }
                })
            }
            
        },
        handlePictureCardPreview(file) {
            console.log('----预览------',file);
            this.dialogImageUrl = file.url;
            this.dialogVisible = true;
        },
        dialogclose(){
            
            //关闭添加账号弹框时，若有已上传但并未保存时应删除已上传的图片
            if(this.dialogVisibleTit == '添加账号'){
                //营业执照
                if(this.anm_business_license.anm_business_license){

                    data.file_name = this.anm_business_license.add_url;
                    conf.company.delpic(data,(state,res)=>{
                        if(state == 'success'&&res.data.code == 0){
                            this.$message({
                                type: 'success',
                                message: '删除成功'
                            });
                            this.anm_business_license = {};
                            this.yyzzfilelist = [];
                            this.yyzzuploadDisabled = false;
                        }else{
                            this.yyzzuploadDisabled = true;
                            this.$message({
                                type: 'info',
                                message: res.data.msg
                            });
                        }
                    })

                }
                //身份证  正面
                if(this.anm_identity_face.anm_identity_face){

                    data.file_name = this.anm_identity_face.add_url;
                    conf.company.delpic(data,(state,res)=>{
                        if(state == 'success'&&res.data.code == 0){
                            this.$message({
                                type: 'success',
                                message: '删除成功'
                            });
                            this.anm_identity_face = {};
                            this.sfzzfilelist = [];
                            this.idZuploadDisabled = false;
                        }else{
                            this.idZuploadDisabled = true;
                            this.$message({
                                type: 'info',
                                message: res.data.msg
                            });
                        }
                    })

                }

                //身份证  反面
                if(this.anm_identity_side.anm_identity_side){

                    data.file_name = this.anm_identity_side.add_url;
                    conf.company.delpic(data,(state,res)=>{
                        if(state == 'success'&&res.data.code == 0){
                            this.$message({
                                type: 'success',
                                message: '删除成功'
                            });
                            this.anm_identity_side = {};
                            this.sfzffilelist = [];
                            this.idFuploadDisabled = false;
                        }else{
                            this.idFuploadDisabled = true;
                            this.$message({
                                type: 'info',
                                message: res.data.msg
                            });
                        }
                    })

                }
            }

            this.$refs['form'].resetFields();
        },
        //取消 添加
        cancelAdd(formName,data=Object()){

            this.centerDialogVisible = false;
            this.$refs[formName].resetFields();
        },
        //创建表
        creatform(row,data=Object()){
            // console.log(row);
            this.c_id = row.anm_id;  //公司id

            data.c_id = this.c_id;
            conf.creattable.gettablestatus(data,(state,res)=>{
                if(state == 'success'&&res.data.code == 0){
                    // console.log(res);
                    this.creatdata = res.data.data;

                    let sign = 0;  //
                    for(var i=0; i< 3; i++){
                        if(this.creatdata[i].disabled){
                            sign = 1;
                        }
                    }
                    
                    if(sign != 1){
                        this.btnstatus = false;
                    }else{
                        this.btnstatus = true;
                    }
                    // console.log(sign,this.btnstatus);

                }else{
                    this.$message({
                        type: 'info',
                        message: res.data.msg
                    });
                }
            })

            this.creatdialogVisible = true;
        },
        //提交创建表
        creatFun(row,data=Object()){
            console.log(row);
            this.$confirm('确定创建 “'+row.name+'” 吗?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                //创建表

                data.c_id = this.c_id;  //公司id
                let aa = row.path;
                conf.creattable[aa](data,(state,res)=>{
                    if(state == 'success'&&res.data.code == 0){
                        this.$message({
                            type: 'success',
                            message: '创建成功'
                        });
                        this.creatdata[parseInt(row.id) - 1].disabled = true;

                        let sign = 0;  //
                        for(var i=0; i< 3; i++){
                            if(this.creatdata[i].disabled){
                                sign = 1;
                            }
                        }
                        
                        if(sign != 1){
                            this.btnstatus = false;
                        }else{
                            this.btnstatus = true;
                        }

                    }else{
                        this.$message({
                            type: 'info',
                            message: res.data.msg
                        });
                    }
                })

            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消创建'
                });          
            });
        },
        //创建表完成启用账号
        creatbtn(data=Object()){
            this.$confirm('是否已将所有表创建完成，开始启用该账号?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => {
                  //启用账号
                    data.nm_id = this.c_id;
                    conf.creattable.examineaccount(data,(state,res)=>{
                        if(state == 'success'&&res.data.code == 0){
                            this.$message({
                                type: 'success',
                                message: '成功启用账号'
                            });
                            this.creatdialogVisible = false;
                            
                        }else{

                            this.$message({
                                type: 'info',
                                message: res.data.msg
                            });
                        }
                    })
              }).catch(() => {
                this.$message({
                  type: 'info',
                  message: '已取消'
                });          
              });
        },
    },
    mounted (){
        this.$nextTick(function(){
            this.getList();
        })
    },
}